﻿namespace LinqEx.Tests
{
	using Microsoft.VisualStudio.TestTools.UnitTesting;
	using System;
	using System.Collections.Generic;
	using System.Linq;

	[TestClass]
	public class StringExtensionTests
	{
		[TestMethod]
		public void SplitToLines()
		{
			string candidate = @"First line
Second line
Third line";

			string[] result = candidate.SplitToLines().ToArray();

			CollectionAssert.AreEqual(result, new[] { "First line", "Second line", "Third line" });
		}

		[TestMethod]
		[ExpectedException(typeof(ArgumentNullException))]
		public void SplitToLines_SourceIsNull()
		{
			StringExtensions.SplitToLines(null).GetEnumerator().MoveNext();
		}
	}
}
